package com.fnst.caesar;

import java.io.*;
import org.apache.poi.hssf.usermodel.*;

public class POIWriteDemo
{

	/**
	 * @param args
	 */
	public static void main(String[] args)
	{
		String path = "excel/output.xls";
		int width = 5120;
		short height = 500;
		try
		{
			HSSFWorkbook wb = new HSSFWorkbook();
			HSSFSheet sh = wb.createSheet("test");
			for(int i = 0; i < 10; i++)
			{
				sh.setColumnWidth(i, width);
				HSSFRow row = sh.createRow(i);
				for(int j = 0; j < 10; j++)
				{
					row.setHeight(height);
					HSSFCell cell = row.createCell(j);
					HSSFRichTextString rts = new HSSFRichTextString("so long a test<"+i+":"+j+">");
					cell.setCellValue(rts);
				}
			}
			
			FileOutputStream fos = new FileOutputStream(path);
			wb.write(fos);
			fos.close();
			
		}
		catch(Exception e)
		{
			System.out.print(e.toString());
		}
	}

}
